package com.liuhx.service.impl;

import com.liuhx.entity.CityEntity;
import com.liuhx.mapper.CityMapper;
import com.liuhx.service.CityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by liuhx on 2017/6/21.
 */
@Service
public class CityServiceImpl implements CityService {
    @Resource
    CityMapper cityMapper;
    @Override
    public void insertCitys(List<CityEntity> cityEntityList) {
        List<CityEntity> cityEntities = cityMapper.findAllCity();
        cityEntityList.removeAll(cityEntities);
        if(cityEntityList.size()>0) {
            cityMapper.insertCitys(cityEntityList);
        }
    }

    @Override
    public List<CityEntity> findCitys() {
        return cityMapper.findAllCityHaveId();
    }


}
